﻿using System;
using System.Collections.Generic;
using System.Text;
using RobotRace.utils.graph;
using RobotRace.Geometry;

namespace RobotRace.engine.path
{
    public class SimpleCheckpointManagementStrategy : CheckpointManagementStrategy
    {
        private Node currentCheckpoint;

        public Node findNextPoint(PathGraph graph, Point2D ignoredArgument)
        {
            if (graph.Count == 0)
            {
                return null;
            }
            currentCheckpoint = getCurrentCheckpoint(graph).edges[0].toNode;
            return currentCheckpoint;
        }

        public Node getCurrentCheckpoint(PathGraph graph)
        {
            if (currentCheckpoint == null)
            {
                currentCheckpoint = graph.getFirstNodeInSequence();
            }
            return currentCheckpoint;
        }
    }
}
